package com.ecreditpal.audio.rpc.client.model;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.13.1)",
    comments = "Source: speech.proto")
public final class SpeechServiceGrpc {

  private SpeechServiceGrpc() {}

  public static final String SERVICE_NAME = "SpeechService";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<Speech.SpeechRequest,
      Speech.SpeechResponse> getSpeechSegMethod;

  public static io.grpc.MethodDescriptor<Speech.SpeechRequest,
      Speech.SpeechResponse> getSpeechSegMethod() {
    io.grpc.MethodDescriptor<Speech.SpeechRequest, Speech.SpeechResponse> getSpeechSegMethod;
    if ((getSpeechSegMethod = SpeechServiceGrpc.getSpeechSegMethod) == null) {
      synchronized (SpeechServiceGrpc.class) {
        if ((getSpeechSegMethod = SpeechServiceGrpc.getSpeechSegMethod) == null) {
          SpeechServiceGrpc.getSpeechSegMethod = getSpeechSegMethod = 
              io.grpc.MethodDescriptor.<Speech.SpeechRequest, Speech.SpeechResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "SpeechService", "SpeechSeg"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  Speech.SpeechRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  Speech.SpeechResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new SpeechServiceMethodDescriptorSupplier("SpeechSeg"))
                  .build();
          }
        }
     }
     return getSpeechSegMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static SpeechServiceStub newStub(io.grpc.Channel channel) {
    return new SpeechServiceStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static SpeechServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new SpeechServiceBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static SpeechServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new SpeechServiceFutureStub(channel);
  }

  /**
   */
  public static abstract class SpeechServiceImplBase implements io.grpc.BindableService {

    /**
     */
    public void speechSeg(Speech.SpeechRequest request,
        io.grpc.stub.StreamObserver<Speech.SpeechResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getSpeechSegMethod(), responseObserver);
    }

    @Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getSpeechSegMethod(),
            asyncUnaryCall(
              new MethodHandlers<
                Speech.SpeechRequest,
                Speech.SpeechResponse>(
                  this, METHODID_SPEECH_SEG)))
          .build();
    }
  }

  /**
   */
  public static final class SpeechServiceStub extends io.grpc.stub.AbstractStub<SpeechServiceStub> {
    private SpeechServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private SpeechServiceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected SpeechServiceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new SpeechServiceStub(channel, callOptions);
    }

    /**
     */
    public void speechSeg(Speech.SpeechRequest request,
        io.grpc.stub.StreamObserver<Speech.SpeechResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getSpeechSegMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class SpeechServiceBlockingStub extends io.grpc.stub.AbstractStub<SpeechServiceBlockingStub> {
    private SpeechServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private SpeechServiceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected SpeechServiceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new SpeechServiceBlockingStub(channel, callOptions);
    }

    /**
     */
    public Speech.SpeechResponse speechSeg(Speech.SpeechRequest request) {
      return blockingUnaryCall(
          getChannel(), getSpeechSegMethod(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class SpeechServiceFutureStub extends io.grpc.stub.AbstractStub<SpeechServiceFutureStub> {
    private SpeechServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private SpeechServiceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected SpeechServiceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new SpeechServiceFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<Speech.SpeechResponse> speechSeg(
        Speech.SpeechRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getSpeechSegMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_SPEECH_SEG = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final SpeechServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(SpeechServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @Override
    @SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_SPEECH_SEG:
          serviceImpl.speechSeg((Speech.SpeechRequest) request,
              (io.grpc.stub.StreamObserver<Speech.SpeechResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @Override
    @SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class SpeechServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    SpeechServiceBaseDescriptorSupplier() {}

    @Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return Speech.getDescriptor();
    }

    @Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("SpeechService");
    }
  }

  private static final class SpeechServiceFileDescriptorSupplier
      extends SpeechServiceBaseDescriptorSupplier {
    SpeechServiceFileDescriptorSupplier() {}
  }

  private static final class SpeechServiceMethodDescriptorSupplier
      extends SpeechServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    SpeechServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (SpeechServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new SpeechServiceFileDescriptorSupplier())
              .addMethod(getSpeechSegMethod())
              .build();
        }
      }
    }
    return result;
  }
}
